home *** CD-ROM | disk | FTP | other *** search
/ Acorn Risc Technologies StrongARM CD-ROM / Acorn Risc Technologies StrongARM CD-ROM.iso / ftp / documents / appnotes / 200_215 / 201c / text
Encoding:
Text File  |  1993-08-02  |  7.6 KB  |  193 lines

  1. -----------------------------------------------------------------------------
  2. 14th July 1992
  3. -----------------------------------------------------------------------------
  4. Support Group Application Note
  5. Number: 201
  6. Issue: 1
  7. Author: James Bye
  8. -----------------------------------------------------------------------------
  9.  
  10. Scrap Files - the use of !Scrap and ScrapFile storage
  11.  
  12. -----------------------------------------------------------------------------
  13. Applicable Hardware: All Acorn RISC OS based computers
  14.  
  15. Related Application Notes:
  16.  
  17.  
  18. -----------------------------------------------------------------------------
  19. Copyright (C) Acorn Computers Limited 1992
  20.  
  21. Every effort has been made to ensure that the information in this leaflet is 
  22. true and correct at the time of printing. However, the products described in
  23. this leaflet are subject to continuous development and improvements and
  24. Acorn Computers Limited reserves the right to change its specifications at
  25. any time. Acorn Computers Limited cannot accept liability for any loss or
  26. damage arising from the use of any information or particulars in this
  27. leaflet. ACORN, ECONET and ARCHIMEDES are trademarks of Acorn Computers
  28. Limited.
  29. -----------------------------------------------------------------------------
  30. Support Group
  31. Acorn Computers Limited
  32. Acorn House
  33. Vision Park
  34. Histon
  35. Cambridge       CB4 4AE
  36. -----------------------------------------------------------------------------
  37.  
  38. Due to the requirements of single floppy and network users with regards to
  39. temporary file storage, it was important that a definite step was put
  40. forward in the area of scrap file storage.  Originally, scrap files where
  41. stored inside the !System application but the scrap file part has been
  42. removed and placed inside its own application, !Scrap. 
  43.  
  44.  
  45. History
  46.  
  47. With older applications the system variable <Wimp$Scrap> was used to ensure
  48. that scrap files were placed inside the !System directory. Applications
  49. which use this variable will function correctly when !Scrap is used, as
  50. !Scrap simply redirects the file from !System to itself. Files generated in
  51. this manner invariably use the name Scrapfile.
  52.  
  53. Some developers allowed an application to create multiple scrap files.
  54. Others were worried that another application may overwrite the newly created
  55. scrap file with other data. This led to the situation were applications
  56. explicitly directed scrap files into the !System directory, via the use of
  57. <System$Path>, and created unique names, based on the application name, for
  58. scrap files.
  59.  
  60. This method is, of course, fine until the application is placed on a
  61. network. There may then be a number of users sharing the same !System. The
  62. situation previously described reappears. 
  63.  
  64.  
  65. About !Scrap
  66.  
  67. !Scrap gives the computer somewhere to store temporary files.  Applications
  68. often use temporary files during copying or saving; however these files are
  69. always deleted when they are no longer needed.
  70.  
  71. Hard disc users should always store !Scrap in the root directory of their
  72. hard disc.  This is so !Scrap is always seen when the root directory is
  73. catalogued.
  74.  
  75. Floppy disc users should keep a copy of !Scrap on every floppy that contains
  76. an application.  This may seem wasteful of disc space, but scrap only takes
  77. up minimal space when not in use.  Also keeping !Scrap on every 'work' disc
  78. will eliminate the need for constant disc swapping, as long as you are using
  79. the !Scrap on the current floppy disc (this can be achieved by double
  80. clicking on the new !Scrap each time a new disc is place in the drive).
  81.  
  82. On a network, a copy of !Scrap should be placed in each user's root
  83. directory.  Do not worry about multiple users using the same user's root
  84. (e.g. 5 different stations logged on as user 'Geography') as !Scrap is
  85. intelligent enough to create scrap directories for each logged on user.
  86.  
  87. With current copies of !Scrap the directory ScrapDir is used, unless the
  88. pathname indicates that it is stored on a network, in which case the network
  89. and station number are used to generate a unique directory name. The name is
  90. displayed thus:
  91.  
  92.         Stn021!210
  93. Where 
  94. Stn021 is used to ensure that the directories appear at the same point
  95. in the directory catalogue.
  96.  
  97. 021 is the network number.
  98.  
  99. ! is used as a separator.
  100.  
  101. 210 is the station number.
  102.  
  103. So a directory titled Stn002!140 would indicate that this is the scrap file
  104. area for station 140 on network 2.
  105.  
  106.  
  107. Writing applications which use !Scrap
  108.  
  109. When writing an application which needs to generate scrap files there are a
  110. number of basic rules which should be obeyed. These are:
  111.  
  112.         If there will only ever be a single scrap file created by the
  113.         application
  114.         then use a name which is unique. 
  115.  
  116.         If there are likely to be multiple scrap files generated by the
  117.         application, then create a directory inside the scrap area into
  118.         which the application can place its scrap files.  If you do need to
  119.         create such a directory then you should register the name of the
  120.         directory with Developer Support.
  121.  
  122. It is important that the correct lines are also appended to the !Run file of
  123. your application.  The lines that are appended depend on how scrap files are
  124. going to be used.
  125.  
  126.  
  127. Single scrap files
  128.  
  129. When your application only deals with single scrap files, the following
  130. commands should be appended to your !Run file :-
  131.  
  132.         If "<Wimp$ScrapDir>" = "" Then Error 0 !Scrap has not been run.
  133. Please locate !Scrap. Else SetMacro App1$Scrap <Wimp$ScrapDir>.App1
  134.  
  135. The system variable App1$Scrap should, of course, be replaced with a name
  136. which is appropriate to the application in question.
  137.  
  138. !Scrap will then have a structure as follows :-
  139. (diagram 1)
  140.  
  141.  
  142. Multiple scrap files
  143.  
  144. When your application deals with multiple scrap files, the following
  145. commands should be appended to your !Run file :-
  146.  
  147.         If "<Wimp$ScrapDir>" = "" Then Error 0 !Scrap has not been run.
  148.         Please locate !Scrap. Else Set App1$Scrap <Wimp$ScrapDir>.App1
  149.         |
  150.         If "<Wimp$ScrapDir>" > "" Then CDir <Wimp$ScrapDir>.App1
  151.  
  152. The variables App1$Scrap and App1 should, of course, be replaced with a name
  153. which is appropriate to the application in question.
  154.  
  155. !Scrap will then have a structure as follows :-
  156. (diagram 2)
  157.  
  158.  
  159. Possible Errors
  160.  
  161. Applications that transfer files via scrap files will generate errors if
  162. !Scrap has not been seen.  The possible errors are as follows :-
  163.  
  164. "Can't transfer file" - This means that !Scrap has not been seen be by the
  165.                 filer.  Showing the filer !Scrap, or double
  166.                 clicking on it will solve this. 
  167.  
  168. "Protected disc" -      This means that the current 'scrap' disk has been
  169.                         write protected and the scrap file cannot be
  170.                         written.  This can be solved bu un-protecting the
  171.                         disk, or using !Scrap from another, unprotected
  172.                         disk.
  173.  
  174.  
  175. Supplying !Scrap with third party products
  176.  
  177. If your application uses Scrap files, be it for temporary or longer term
  178. storage, then you will need to supply !Scrap with your application.  The
  179. latest version of !Scrap should be distributed with a copy of !Merge (an
  180. application merging tool) so the user can update/install accordingly.
  181.  
  182. The current version of !Scrap is v0.56 (2-Aug-1991).  If you do not have a
  183. copy of this version or a copy of !Merge, both are available via developer
  184. support on request.
  185.  
  186. If you have any questions about scrap files that are not covered by the
  187. above, then please contact developers support.  If you are unsure about the
  188. way you have implemented your scrap files (especially when dealing with
  189. longer term scrap storage) it is better to be safe and contact developer
  190. support to check that you are doing things correctly.
  191.  
  192.  
  193.